home *** CD-ROM | disk | FTP | other *** search
- Path: csus.edu!csus
- From: sac46826@csus.edu (Mike Billard)
- Newsgroups: comp.lang.c++
- Subject: MFC4.0 Assertion Error- Please Help
- Date: Wed, 20 Mar 96 01:53:48 GMT
- Organization: California State University Sacramento
- Message-ID: <4inogo$7k1@news.csus.edu>
- NNTP-Posting-Host: @u0104-p03.dialin.csus.edu
- X-Newsreader: News Xpress 2.0 Beta #0
-
- As a new programmer to C++ (which I like because it is not as wordy as Pascal)
- I am constantly finding new tools and new problems. My most recent problem is
- quite perplexing. I used MSVC++ 4.0 to build an SDI application and created
- an edit box. I then mapped a CEdit variable, m_Edit, to the edit control.
- Next, I mapped the WM_INITDIALOG message to OnInitDialog, and in that fuction
- I typed: m_Edit.SetWindowText("Default Text");
-
- When I run the application using the default debug mode, I get an assertion
- failure on line 533 of dlgdata.cpp. Unfortunately, it gets stranger from
- here.
-
- If I recompile the program and run it again, I do not get the error.
-
- However, if I restart my computer and run the debug-mode (and release-mode)
- application, I get the same assertion error.
-
- Finally, If I remove the m_Edit.SetWindowText("Default Text"); line from
- OnInitDialog, I do not get the error either after immediate recompilation or
- after performing a system reboot.
-
- I can only surmise that at the point of invoking the OnInitDialog function,
- the memory for the m_Edit variable is not allocated. Is this correct?
-
- Since my goal is to have the dialog box display some default text in its
- edit box, how can I set up the default text at run-time without obtaining this
- assertion failure? Do I need to set up the variables using a different
- function?
-
- Thanks for your help.
-
- Sincerely,
- Mike Billard
- billardm@csus.edu
-
- -Mike Billard
-
- email: billardm@csus.edu
-